Construct a pool with tasks to be executed by one or more threads. Tasks are taken from the pool depending on the number of threads. And are asynchronously executed. The tasks that can be added to the pool must be of type modelit.web.concurrent.Callable
Construct a pool with tasks to be executed by one or more threads. Tasks are taken from the pool depending on the number of threads. And are asynchronously executed. The tasks that can be added to the pool must be of type modelit.web.concurrent.Callable
obj = ThreadPoolExecutor(numberOfThreads)
numberOfThreads | integer | Maximum number of threads for this pool, each thread executes one task. |
obj | modelit.web.concurrent.ThreadPoolExecutor | A pool with tasks, the executors asynchronously execute the tasks in this pool. The number of executors is given by the numberOfThreads argument. Documentation for modelit.web.concurrent.ThreadPoolExecutor/ThreadPoolExecutor doc modelit.web.concurrent.ThreadPoolExecutor |
Stop the executor and remove the remaining tasks.
delete(obj)
obj | modelit.web.concurrent.ThreadPoolExecutor |
No output, the ThreadPoolExecutor is shut down.
Add a new task to the pool. The ThreadPoolExecutor takes care of executing the tasks.
submit(obj, callable)
obj | modelit.web.concurrent.ThreadPoolExecutor | |
callable | modelit.web.concurrent.Callable | The task to be executed |
No direct output, the task is added to the pool. The executor will execute the task when a thread is available.
Get the queue with remaining tasks.
queue = getQueue(obj)
obj | modelit.web.concurrent.ThreadPoolExecutor |
queue | integer | Number of tasks in the queue. |
Cancel the tasks that are in the pool but not executed.
cancel(obj)
obj | modelit.web.concurrent.ThreadPoolExecutor |
Tasks that are in the pool but not yet executed are cancelled.